<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="<s:url value="/css/style.css"/>" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript" src="<s:url value="/js/jquery.js"/>"></script>
		<script type="text/javascript" src="<s:url value="/js/common.js"/>"></script>
		<link href="<s:url value="/css/jquery.css"/>" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript" src="<s:url value="/js/jquery.js"/>"></script>
		<script type="text/javascript" src="<s:url value="/js/common.js"/>"></script>
		<script type="text/javascript" src="<s:url value="/js/jquery-ui.js"/>"></script>
		<script type='text/javascript' src="<s:url value="/js/tableSel2.js"/>"></script>
		<script type="text/javascript">
			function dosubmit(){
				$('#listForm').submit();
			};
			function goEdit(){
				location.href='<s:url value="/system/TodoEvent/edit"/>';
			};
			function goAction(id,url){
				window.open(url);
				$('#'+id).find('td').attr('class','tablecolour1');
			};
			function goFinish(form){
				form = document.getElementById('listForm');
				var ids = getSelectionIds('a');
				if(ids.length<1){
					alert('Please select one at least.');
				}else{
					form.action=form.action.replace('list','finish');
					$('#ids').val(ids);
					form.submit();
				}
			};
			$( function() {
				$('#startDate').datepicker({dateFormat:'yy-mm-dd'});
				$('#endDate').datepicker({dateFormat:'yy-mm-dd'});
			});
</script>
		<title><s:text name="system.title" />
		</title>
	</head>
	<body>
		<s:include value="/common/up.jsp"></s:include>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="box">
					<s:form action="TodoEvent/list" name="listForm" id="listForm"
						method="post" namespace="/system">
						<input type="hidden" id="startIndex" name="startIndex" value="0" />
						<s:hidden name="ids" id="ids" value="" />
						<table width="100%" border="0" cellpadding="0" cellspacing="0"
							class="searchbg">
							<tr>
								<td>
									Status:
									<s:select name="status" listKey="name()" headerKey=""
										headerValue="---all---"
										list="@com.ef.constant.EUserTodoStatus@values()" />
									Org Type:
									<s:select name="toObject" listKey="name()" headerKey=""
										headerValue="---all---"
										list="@com.ef.constant.EUserTodoObject@values()" />
									Type:
									<s:select name="todoType" listKey="name()" headerKey=""
										headerValue="---all---"
										list="@com.ef.constant.EUserTodoType@values()" />
									Remind From:
									<s:date name="startDate" format="yyyy-MM-dd" var="tstartDate" />
									<s:textfield value="%{#tstartDate}" size="10" name="startDate"
										id="startDate" />
									To:
									<s:date name="endDate" format="yyyy-MM-dd" var="tendDate" />
									<s:textfield value="%{#tendDate}" size="10" name="endDate"
										id="endDate" />
									PageSize:
								    <s:textfield size="3" name="pageSize" cssClass="input2"></s:textfield>
									<img src="<s:url value="/img/right/btns.gif"/>" border="0"
										align="absmiddle" onclick="javascript:dosubmit();" />
									<img onclick="javascript:goEdit();"
										src="<s:url value="/img/right/btn1.gif"/>" border="0"
										align="absmiddle" />
									<img onclick="goFinish(this.form);"
										src="<s:url value="/img/right/Finish.gif"/>" border="0"
										align="absmiddle" />
								</td>
							</tr>
						</table>
					</s:form>
					<table width="100%" border="0" cellpadding="0" cellspacing="1"
						class="box2">
						<tr>
							<td width="33" class="tablecolour1">
								<input type="checkbox" name="all" onclick="checkAll('a',this)" />
							</td>
							<td class="tablecolour1">
								Status
							</td>
							<td class="tablecolour1">
								Title
							</td>
							<td class="tablecolour1">
								Create Time
							</td>
							<td class="tablecolour1">
								From
							</td>
							<td class="tablecolour1">
								Remind Start Time
							</td>
							<td class="tablecolour1">
								Remind End Time
							</td>
							<td class="tablecolour1">
								Function
							</td>
						</tr>
						<s:iterator value="listResult.items" status="status">
							<tr id='<s:property value="id" />'>
								<td class="tablecolour2">
									<s:set name="canFinish" value="isCanFinish()" />
									<s:if test="#canFinish == true">
										<input type="checkbox" name="a"
											value="<s:property value="id" />" />
									</s:if>
								</td>
								<td class="tablecolour2">
									<s:property value="status" />
								</td>
								<td class="tablecolour2">
									<s:property value="title" />									 
								</td>
								<td class="tablecolour2">
									<s:date format="yyyy-MM-dd H:mm" name="createTime" />
								</td>

								<td class="tablecolour2">
									<s:property value="toObjectMessage" />
								</td>
								<td class="tablecolour2">
									<s:date format="yyyy-MM-dd H:mm" name="reminderStartTime" />
								</td>
								<td class="tablecolour2">
									<s:date format="yyyy-MM-dd H:mm" name="reminderEndTime" />
								</td>
								<td class="tablecolour2">
									<a
										href='<s:url value="/system/TodoEvent/view?id="/><s:property value="id"/>'>View</a>
									<s:set name="canEdit"
										value="isCanEdit(#session._current_user.id)" />
									<s:if test="#canEdit == true">
										<a
											href='<s:url value="/system/TodoEvent/edit?id="/><s:property value="id"/>'>Edit</a>
									</s:if>
									<s:set name="canCancel"
										value="isCanCancel(#session._current_user.id)" />
									<s:if test="#canCancel == true">
										<a
											href='<s:url value="/system/TodoEvent/delete?id="/><s:property value="id"/>'>Delete</a>
									</s:if>
									<s:set name="hasAction" value="hasAction()" />
									<s:if test="#hasAction == true">
										<s:set name="goaction" value="goAction" />
										<a href="javascript:goAction('<s:property value="id" />','<%=basePath%><s:property value="#goaction"/>')">Action</a>
									</s:if>
								</td>
							</tr>
						</s:iterator>
					</table>
					<s:include value="/common/page.jsp"></s:include>
				</td>
			</tr>
		</table>
		<s:include value="/common/down.jsp"></s:include>
	</body>
</html>